package com.library.Mapper;

import com.github.pagehelper.Page;
import com.library.pojo.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BookMapper {
    /**
     * 分页查询书本
     * @param bookName
     * @param author
     * @param publisher
     * @return
     */
    List<Book> list(@Param("bookName") String bookName,@Param("author") String author,
                    @Param("publisher") String publisher,@Param("category") String category);

    /**
     * 添加8图书
     * @param book
     */
    void add(Book book);

    /**
     * 根据id查询书籍的分类
     * @param id
     * @return
     */
    @Select("select category from book where id =#{id}")
    String getCategoryById(Long id);

    /**
     * 删除图书
     * @param ids
     */
    void delete(@Param("ids")List<Long> ids);

    /**
     * 根据id查询书籍
     * @param id
     * @return
     */
    @Select("select * from book where id= #{id}")
    Book getById(Long id);

    void update(Book book);
}
